package system.commands;

import static java.lang.System.out;

import jicosfoundation.Command;
import jicosfoundation.Proxy;
import jicosfoundation.ServiceImpl;
import system.Vertex;
import system.Worker;
import system.ProxyWorker;

/**
 *
 * @author Pete Cappello
 */
public class AddVertexToPart implements Command
{
    private int    partId;
    private Vertex vertex;
    private Worker sendingWorker;
    
    public AddVertexToPart( int partId, Vertex vertex, Worker sendingWorker )
    {
        this.partId = partId;
        this.vertex = vertex;
        this.sendingWorker = sendingWorker;
    }

    @Override
    public void execute( Proxy proxy ) { proxy.sendCommand( this ); }

    @Override
    public void execute(ServiceImpl serviceImpl) throws Exception 
    {
        Worker worker = (Worker) serviceImpl;
        worker.addVertexToWorker( partId, vertex, sendingWorker );
    }
}
